//her startes fullPage.js der giver vores one page effekt
$(document).ready(function() {
	$.fn.fullpage({
		//slidesColor: ['#1bbc9b', '#4BBFC3', '#7BAABE', '#ccddff'],
		anchors: ['firstPage', 'secondPage', '3rdPage', 'lastPage'],
		scrollingSpeed: 500,
		menu: '#menu',
		verticalCentered: false,
		paddingTop: '100px',
		fixedElements: 'header'
	});
	$(".inline").colorbox({inline:true, width:"50%"});
});

//gør login pop draggable
$(function() {
	$( "#inline_content" ).draggable();
});

//starter shake når du holder musen nede over milkshaken.
$("#shakewrapper").mousedown(function(){
	shake()
});

//shake funktion der animere og tæller op i 10 seckunder og smidder link ud der.
function shake(){
$("#milkshake").animate({top: "-50"}, 125).animate({top: "+50"}, 125).animate({top: "-50"}, 125).animate({top: "+50"}, 125);
}
	var timeout, clicker = $('#shakewrapper');
	var count = 0;
	
	clicker.mousedown(function(){
	timeout = setInterval(function(){
	count++;
	if(count === 10){
		$("#text").text("");
		$('<a>',{
			id: "shakelink",
			text:'Click here to collect your Shakepoints',
			href:'collect.php'
			}).appendTo('#text');
		//$('#text').remove();
	}
	else if(count < 10) {
		shake()
		$("#text").text(count);
	}
}, 500);
return false;
});

//stopper shake nå musseknappen slippes
$(document).mouseup(function(){
clearInterval(timeout);
return false;
});

//resizer youtube iframen på window resize.
$(function() {
	var $allVideos = $("iframe");
	    $fluidEl = $("#video");
	$allVideos.each(function() {
		$(this)
			.data('aspectRatio', this.height / this.width)
			.removeAttr('height')
			.removeAttr('width');
	});
	$(window).resize(function() {
		var newWidth = $fluidEl.width();
		$allVideos.each(function() {
			var $el = $(this);
			$el
				.width(newWidth)
				.height(newWidth * $el.data('aspectRatio'));
		});
	}).resize();

});
//ryste animation til milkshakes
setInterval(function() {$(".milkshakes").animate({marginTop: "-50"}, 125).animate({marginTop: "+50"}, 125).animate({marginTop: "-50"}, 125).animate({marginTop: "+50"}, 125)},500);